package healthyPointsManager.pojo
{
	import mx.controls.DateField;
	
	public class Profile
	{
		private var _userId:Number;
		private var _username:String;
		private var _password:String;
		private var _firstName:String;
		private var _lastName:String;		
//		private var _name:String;
		private var _dateCreated:Date;
		private var _dateOfBirth:Date;
		private var _email:String;		
		private var _weight:Number;
		private var _height:Number;
		private var _activityLevel:int;		
		private var _gender:String;
		private var _isNursing:String;
		private var _pointsAdjusted:int;
		private var _goalWeight:Number;
		private var _goalDate:Date;
		//points related fields
		private var _pointsId:Number;
		private var _dailyPoints:Number;
		private var _dailyPointsRemaining:Number;
		private var _weeklyPoints:Number;
		private var _weeklyPointsRemaining:Number;
		private var _activityPoints:Number;
		private var _activityPointsRemaining:Number;
		private var _startDate:Date;
		private var _endDate:Date;
		
		
		public function Profile()
		{
		}
		
		public static function createProfile(value:Object):Profile{
			var returnValue:Profile = new Profile();
			if(value != null ){
				//profile information
				returnValue.userId = isNaN(value.userId) ? 0 : value.userId;
				returnValue.password = value.password;
				returnValue.username = value.username;				
				returnValue.firstName = value.firstName;				
				returnValue.lastName = value.lastName;
				returnValue.gender = value.gender;
				returnValue.dateOfBirth = value.birthdate == null ? null : DateField.stringToDate(value.birthdate, "YYYY-MM-DD");				
				returnValue.email = value.email;
				returnValue.weight = value.weight;
				returnValue.height = value.height;			
				returnValue.goalWeight = value.goalWeight;
				returnValue.goalDate = value.goalDate == null ? null : DateField.stringToDate(value.goalDate, "YYYY-MM-DD");
				returnValue.isNursing = value.isNursing;
				returnValue.pointsAdjusted = value.pointsAdjusted;
				returnValue.activityLevel = value.activityLevel;
				//points information
				returnValue.pointsId = isNaN(value.pointsId) ? 0 : value.pointsId;				
				returnValue.dailyPoints = isNaN(value.dailyPoints) ? 0 : value.dailyPoints;
				returnValue.dailyPointsRemaining = isNaN(value.dailyPointsRemaining) ? value.dailyPoints : value.dailyPointsRemaining;	
				returnValue.weeklyPoints = isNaN(value.weeklyPoints) ? 0 : value.weeklyPoints;
				returnValue.weeklyPointsRemaining = isNaN(value.weeklyPointsRemaining) ? value.weeklyPoints : value.weeklyPointsRemaining;
				returnValue.activityPoints = isNaN(value.activityPoints) ? 0 : value.activityPoints;				
				returnValue.activityPointsRemaining = isNaN(value.activityPointsRemaining) ? value.activityPoints : value.activityPointsRemaining;				
				
			}		
			return returnValue;		
		}
		
		/**
	     * @return the id
	     */
	    public function get userId():Number {
	        return _userId;
	    }
	
	    /**
	     * @param id the id to set
	     */
	    public function set userId(userId:Number):void{
	        this._userId = userId;
	    }
	    
	    public function get username():String {
	        return _username;
	    }	
	 
	    public function set username(username:String):void{
	        this._username = username;
	    }
	    
	    public function get password():String {
	        return _password;
	    }	
	 
	    public function set password(password:String):void{
	        this._password = password;
	    }
	    	   
	    public function get name():String{
	        return _lastName + ", " + _firstName;
	    }
	        	   
	    public function get firstName():String{
	        return _firstName;
	    }
		    
	    public function set firstName(firstName:String):void{
	        this._firstName = firstName;
	    }	    	    
	    	        	   
	    public function get lastName():String{
	        return _lastName;
	    }
		    
	    public function set lastName(lastName:String):void{
	        this._lastName = lastName;
	    }
	    
	    public function get gender():String{
	        return _gender;
	    }
		    
	    public function set gender(gender:String):void{
	        this._gender = gender;
	    }
	    
	    public function get isNursing():String{
	        return _isNursing;
	    }
		    
	    public function set isNursing(isNursing:String):void{
	        this._isNursing = gender;
	    }
	    	    
	    	    
	    public function get email():String{
	        return _email;
	    }	
	    
	    public function set email(email:String):void{
	        this._email = email;
	    }
	    
	    public function get dateCreated():Date{
	        return _dateCreated;
	    }	
	    
	    public function set dateCreated(dateCreated:Date):void{
	        this._dateCreated = dateCreated;
	    }
	    
	    public function get dateOfBirth():Date{
	        return _dateOfBirth;
	    }	
	    
	    public function set dateOfBirth(dateOfBirth:Date):void{
	        this._dateOfBirth = dateOfBirth;
	    }
	   
	    public function get height():Number {
	        return _height;
	    }
	
	 
	    public function set height(height:Number):void {
	        this._height= height;
	    }
	    
	     public function get activityLevel():int{
	        return _activityLevel;
	    }
	
	 
	    public function set activityLevel(activityLevel:int):void {
	        this._activityLevel = activityLevel;
	    }
	    
	     public function get pointsAdjusted():int {
	        return _pointsAdjusted;
	    }
	
	 
	    public function set pointsAdjusted(pointsAdjusted:int):void {
	        this._pointsAdjusted = pointsAdjusted;
	    }
	    
	    /**
	     * @return the weight
	     */
	    public function get weight():Number {
	        return _weight;
	    }
	
	    /**
	     * @param weight the weight to set
	     */
	    public function set weight(weight:Number):void {
	        this._weight = weight;
	    }
	
	    /**
	     * @return the goalWeight
	     */
	    public function get goalWeight():Number {
	        return _goalWeight;
	    }
	
	    /**
	     * @param goalWeight the goalWeight to set
	     */
	    public function set goalWeight(goalWeight:Number):void {
	        this._goalWeight = goalWeight;
	    }
	
	    /**
	     * @return the goalDate
	     */
	    public function get goalDate():Date {
	        return _goalDate;
	    }
	
	    /**
	     * @param goalDate the goalDate to set
	     */
	    public function set goalDate(goalDate:Date):void {
	        this._goalDate = goalDate;
	    }
		
		
		
	
	    public function get pointsId():Number {
	        return _pointsId;
	    }
	
	   
	    public function set pointsId(pointsId:Number):void {
	        this._pointsId = pointsId;
	    }
		
		/**
	     * @return the dailyPoints
	     */
	    public function get dailyPoints():Number {
	        return _dailyPoints;
	    }
	
	    /**
	     * @param dailyPoints the dailyPoints to set
	     */
	    public function set dailyPoints(dailyPoints:Number):void {
	        this._dailyPoints = dailyPoints;
	    }
	
	    /**
	     * @return the dailyPointsRemaining
	     */
	    public function get dailyPointsRemaining():Number{
	        return _dailyPointsRemaining;
	    }
	
	    /**
	     * @param dailyPointsRemaining the dailyPointsRemaining to set
	     */
	    public function set dailyPointsRemaining(dailyPointsRemaining:Number):void {
	        this._dailyPointsRemaining = dailyPointsRemaining;
	    }
	
	    /**
	     * @return the weeklyPoints
	     */
	    public function get weeklyPoints():Number {
	        return _weeklyPoints;
	    }
	
	    /**
	     * @param weeklyPoints the weeklyPoints to set
	     */
	    public function set weeklyPoints(weeklyPoints:Number):void {
	        this._weeklyPoints = weeklyPoints;
	    }
	
	    /**
	     * @return the weeklyPointsRemaining
	     */
	    public function get weeklyPointsRemaining():Number {
	        return _weeklyPointsRemaining;
	    }
	
	    /**
	     * @param weeklyPointsRemaining the weeklyPointsRemaining to set
	     */
	    public function set weeklyPointsRemaining(weeklyPointsRemaining:Number):void {
	        this._weeklyPointsRemaining = weeklyPointsRemaining;
	    }
	
	    /**
	     * @return the activityPoints
	     */
	    public function get activityPoints():Number{
	        return _activityPoints;
	    }
	
	    /**
	     * @param activityPoints the activityPoints to set
	     */
	    public function set activityPoints(activityPoints:Number):void{
	        this._activityPoints = activityPoints;
	    }
	
	    /**
	     * @return the activityPointsRemaining
	     */
	    public function get activityPointsRemaining():Number {
	        return _activityPointsRemaining;
	    }
	
	    /**
	     * @param activityPointsRemaining the activityPointsRemaining to set
	     */
	    public function set activityPointsRemaining(activityPointsRemaining:Number):void {
	        this._activityPointsRemaining = activityPointsRemaining;
	    }


	}
}